var currentPage = 1;
var pageSize = 5;
var totalCount = 0;
var totalPage = 1;

function showPage() {
    if (totalPage==0){
        totalPage=1;
    }
    $("#showPage").text(currentPage+"/"+totalPage);
}

function showInfo() {
    let name = $("#name").val().trim();
    let positionName = $("#positionName").val().trim();
    let experience = $("#experience").val().trim();
    let status = $("#status").val().trim();
    let rTime = $("#rTime").val().trim();

    $("#tal1").find("tr:gt(0)").find("td").html("&nbsp;");

    let jsonA={
        name:name,
        positionName:positionName,
        experience:experience,
        status:status,
        rTime:rTime,
        currentPage:currentPage,
        pageSize:pageSize
    }

    $.ajaxSettings.async=false;
    $.getJSON("showMianShi",jsonA,function(data){
        totalCount=data.total;
        totalPage=data.pages;
        $(data.list).each(function (i,v) {
            $("#tal1").find("tr").eq(i+1).find("td").eq(0).text(v.name);
            $("#tal1").find("tr").eq(i+1).find("td").eq(1).text(v.sex);
            $("#tal1").find("tr").eq(i+1).find("td").eq(2).text(v.school);
            $("#tal1").find("tr").eq(i+1).find("td").eq(3).text(v.educationBackground);
            $("#tal1").find("tr").eq(i+1).find("td").eq(4).text(v.major);
            $("#tal1").find("tr").eq(i+1).find("td").eq(5).text(v.positionName);
            $("#tal1").find("tr").eq(i+1).find("td").eq(6).text(v.experience);
            $("#tal1").find("tr").eq(i+1).find("td").eq(7).text(v.rTime);
            $("#tal1").find("tr").eq(i+1).find("td").eq(8).html("<div class=\"layui-input-inline\" style=\"display: block;\">\n" +
                "<div class=\"layui-input-block\" style=\"margin-left: 0px;\">\n" +
                "<select name=\"status\" lay-verify=\"\" id=\"status\">\n" +
                "<option value=\"\">--请选择--</option>\n" +
                "<option value=\"录用\">录用</option>\n" +
                "<option value=\"删除\">删除</option>\n" +
                "<option value=\"存档\">存档</option>\n" +
                "</select>\n" +
                "</div>\n" +
                "</div>");
            $("#tal1").find("tr").eq(i+1).find("td").eq(9).html("<a href=\"#\" onclick=\"messageById("+v.resumeId+")\">面试结果登记</a>&nbsp;&nbsp;<a href=\"\">详情</a>&nbsp;&nbsp;<a href=\"\">删除</a>");
        })

    })
    $.ajaxSettings.async=true;
    showPage();

}
function check() {
    showInfo();
}

function next() {
    currentPage++;
    if(currentPage>totalPage){
        currentPage=totalPage;
        return;
    }
    showInfo()
}

function prev() {
    currentPage--;
    if(currentPage<1){
        currentPage=1;
        return;
    }
    showInfo()
}

function first() {
    currentPage=1;
    showInfo()
}

function end() {
    currentPage=totalPage;
    showInfo()
}

function messageById(rId) {
    window.location.href = "/录用结果登记/" + rId;
}